import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '编号',
    align:"center",
    dataIndex: 'spid'
   },
   {
    title: '收款日期',
    align:"center",
    dataIndex: 'sfrq',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '企业代码',
    align:"center",
    dataIndex: 'ph'
   },
   {
    title: '付款单位',
    align:"center",
    dataIndex: 'fkdw'
   },
   {
    title: '工业区',
    align:"center",
    dataIndex: 'gyq'
   },
   {
    title: '收款单位',
    align:"center",
    dataIndex: 'skdw'
   },
   {
    title: '汇入总数',
    align:"center",
    dataIndex: 'hrzg'
   },
/*   {
    title: 'sgjf',
    align:"center",
    dataIndex: 'sgjf'
   },*/
   {
    title: '收费金额',
    align:"center",
    dataIndex: 'sfjg'
   },
   {
    title: '政府占比',
    align:"center",
    dataIndex: 'zfzb'
   },
   {
    title: '村委占比',
    align:"center",
    dataIndex: 'cwzb'
   },
   {
    title: '基金占比',
    align:"center",
    dataIndex: 'fpzb'
   },
   {
    title: '各作各价',
    align:"center",
    dataIndex: 'gzgj',
     customRender:({text})=>{
      if(text=='1')
        return "是";
      if(text=="0")
        return "否";
      return text;

     },
   },
  {
    title: '备注',
    align:"center",
    dataIndex: 'bz'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
     {
      label: "收款日期",
      field: "sfrq",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
      },
      colProps: {span: 6},
	},
	{
      label: "付款单位",
      field: 'fkdw',
      component: 'Input',
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '编号',
    field: 'spid',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入spid!'},
          ];
     },
  },
  {
    label: '收款日期',
    field: 'sfrq',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入sfrq!'},
          ];
     },
  },
  {
    label: '企业代码',
    field: 'ph',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入ph!'},
          ];
     },
  },
  {
    label: '付款单位',
    field: 'fkdw',
    component: 'Input',
  },
  {
    label: '工业区',
    field: 'gyq',
    component: 'Input',
  },
  {
    label: '收款单位',
    field: 'skdw',
    component: 'Input',
  },
  {
    label: '汇入总数',
    field: 'hrzg',
    component: 'InputNumber',
  },
/*  {
    label: 'sgjf',
    field: 'sgjf',
    component: 'InputNumber',
  },*/
  {
    label: '收费金额',
    field: 'sfjg',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入收费金额!'},
          ];
     },
  },
  {
    label: '政府占比',
    field: 'zfzb',
    component: 'InputNumber',
  },
  {
    label: '村委占比',
    field: 'cwzb',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入村委占比!'},
          ];
     },
  },
  {
    label: '基金占比',
    field: 'fpzb',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入fpzb!'},
          ];
     },
  },

  {
    label: '各作各价',
    field: 'gzgj',
    component: 'JSwitch',
    componentProps: {
      options: ['1', '0'],
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入各作各价'},
          ];
     },
  },
  {
    label: '备注',
    field: 'bz',
    component: 'InputTextArea',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
